import Cookies from 'js-cookie'

/***
 * 获取cookies
 * @param key 键
 * @returns {*}
 */
export function getCookies(key) {
  return Cookies.get(key)
}
/***
 * 设置cookies
 * @param key 键
 * @param value 值
 * @param expiresTime 过期时间（单位：秒）
 * @returns {*}
 */
export function setCookies(key, value, expiresTime = 0) {
  const seconds = expiresTime
  const expires = new Date(new Date() * 1 + seconds * 1000)
  return Cookies.set(key, value, { expires: expires })
}

/***
 * 移除cookies
 * @param key 键
 * @returns {*}
 */
export function removeCookies(key) {
  return Cookies.remove(key)
}
